function data = viewlinrois(scan,rois,height)

%function result = viewlinrois(scan,rois,height) shows the scans as a
%function of x-position and energy
%INPUT: scan = a scan structure 
%       rois = a roi structure from click2rois2.m
%       height= number of pixels that the ROI is high (below and above the line)
%OUTPUT: structure containing
%          - 'sorted' contains the scan/ROI in a rectangular array
%          - 'forpic' contains array with where x-axis it the position,
%             y-axis is the stepnumber (could also be energy)

for n=1:length(rois)
    dmy = zeros(2*height+1,length(rois(n).indices)/(2*height+1));
    for m=1:size(scan.A,1)
       for l=1:length(rois(n).indices)
           dmy(l) = scan.A(m,rois(n).indices(l));
       end
       data(n).sorted(m,:,:) = dmy;
    end
end

for n=1:length(rois)
    data(n).forpic = squeeze(sum(data(n).sorted,2));
    imagesc(log(data(n).forpic))
    pause
end